home *** CD-ROM | disk | FTP | other *** search
/ InterCD 2001 April / april_2001.iso / intercd / root / Browsers / ^Enfish_Onespace / setup.exe / setup.cab / div_item.js < prev    next >
Encoding:
Text File  |  2000-10-11  |  2.6 KB  |  104 lines

  1. var    g_strClassNameNormal = "DivNormal",
  2.         g_strClassNameHover = "DivHover";
  3. function get_div_item(objCurrentItem)
  4.     {
  5.     var objItem = null;
  6.     if (objCurrentItem.className == g_strClassNameNormal
  7.         || objCurrentItem.className == g_strClassNameHover)
  8.         objItem = objCurrentItem;
  9.     if (objCurrentItem.parentElement.className == g_strClassNameNormal
  10.         || objCurrentItem.parentElement.className == g_strClassNameHover)
  11.         objItem = objCurrentItem.parentElement;
  12.         
  13.     return objItem;
  14.     }
  15.  
  16. function div_item_onmouseout() {
  17. //    window.event.cancelBubble = true;
  18.     var objItem = get_div_item(window.event.fromElement);
  19.         
  20.     //                    
  21.     if (objItem != null)
  22.         {
  23.         objItem.idTimeout = setTimeout("window.document.all["+objItem.sourceIndex+"].className = \"DivNormal\"",1);
  24.         }    
  25.         
  26.     }
  27.  
  28. function div_item_onmouseover() 
  29.     {
  30. //    window.event.cancelBubble = true;
  31.     var objItem = get_div_item(window.event.toElement);
  32.     clearTimeout(objItem.idTimeout);
  33.         
  34.     if (objItem != null)
  35.         {
  36.         objItem.className = g_strClassNameHover;
  37.         }
  38.     }
  39.  
  40. /*
  41. function div_item_onclick() 
  42.     {
  43.     var objItem = get_div_item(window.event.srcElement);
  44.     alert("CLICKED: "+objItem.innerText);
  45.     }
  46. */
  47.     
  48. /*
  49. function SubItem_onmouseout() 
  50.     {
  51. //    window.event.cancelBubble = true;
  52.     var objItem = get_div_item(window.event.fromElement);
  53.     if (window.event.toElement == null || window.event.toElement.className != g_strClassNameHover)
  54.         {
  55.         objItem.idTimeout = setTimeout("window.document.all["+objItem.sourceIndex+"].className = \""+g_strClassNameNormal+"\"",1);
  56.         }
  57.     }
  58.  
  59. function SubItem_onmouseover() 
  60.     {
  61. //    window.event.cancelBubble = true;
  62.     var objItem = get_div_item(window.event.toElement);
  63.     objItem.className = g_strClassNameHover;
  64.     clearTimeout(objItem.idTimeout);
  65.     }
  66.     */
  67.     
  68. function set_div_item_events(objDivItem)
  69.     {
  70.     if (objDivItem == null)
  71.         {
  72.         for (var nIndex = 0; nIndex < document.body.all.length; nIndex++)
  73.             {
  74.             if (document.body.all[nIndex].className == g_strClassNameNormal)
  75.                 {
  76.                 set_div_item_events(document.body.all[nIndex])
  77.                 }
  78.             }
  79.         return;
  80.         }
  81.     if (objDivItem.className == g_strClassNameNormal)
  82.         {
  83.         objDivItem.onmouseout = div_item_onmouseout;
  84.         objDivItem.onmouseover = div_item_onmouseover;
  85.         objDivItem.onclick = div_item_onclick;
  86.         }
  87.     }
  88.     
  89. function create_div_begin_tag(id)
  90.     {
  91.     if (g_strClassNameNormal == null || g_strClassNameNormal.length == 0)
  92.         return null;
  93.  
  94.     var    strId = id == null ? "" : "ID = \""+id+"\"";
  95.     var    strBeginTag = "<SPAN CLASS=\""+g_strClassNameNormal+"\" "+strId+">";
  96.     return strBeginTag;
  97.     }
  98.     
  99. function create_div_end_tag()
  100.     {
  101.     return "<BR></SPAN>";
  102.     }
  103.  
  104.